// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   pdf_ok.java

package manufacture.export;

import include.excel_export.XlsWriter;
import include.excel_export.excel_three;
import include.get_sql.getKeyColumn;
import include.nseer_cookie.MakePdf;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class pdf_ok extends HttpServlet
{

	public pdf_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			java.io.PrintWriter out = response.getWriter();
			XlsWriter xls = new XlsWriter();
			MakePdf mm = new MakePdf();
			excel_three query = new excel_three();
			getKeyColumn column = new getKeyColumn();
			mm.setConfigFile("xml/manufacture/pdf_export.xml");
			String sql = "";
			String tablename = request.getParameter("tablename");
			String condition = "";
			String queue = "";
			if (tablename.equals("manufacture_manufacture"))
			{
				queue = "order by register_time";
				condition = "where check_tag='1' and excel_tag='2' and manufacture_tag='1'";
			}
			sql = (new StringBuilder("select * from ")).append(tablename).append(" ").append(condition).append(" ").append(queue).toString();
			int a = sql.indexOf("*");
			String sqla = (new StringBuilder(String.valueOf(sql.substring(0, a)))).append("count(*) as A").append(sql.substring(a + 1, sql.length())).toString();
			mm.make((String)dbSession.getAttribute("unit_db_name"), tablename, sqla, sql, "pdf_files/manufacture_data", 1500, session);
			int fileAmount = mm.fileAmount();
			response.sendRedirect((new StringBuilder("manufacture/export/pdf_ok_a.jsp?file_amount=")).append(fileAmount).toString());
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
